<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .father {
        overflow: hidden;
        width: 300px;
        height: 300px;
        margin: 100px auto;
        background-color: pink;
        text-align: center;
    }
    
    .son {
        width: 200px;
        height: 200px;
        margin: 50px;
        background-color: purple;
        line-height: 200px;
        color: #fff;
    }
</style>

<body>
    <div class="father">
        <div class="son">son盒子</div>
    </div>
    <script>
        var son = document.querySelector('.son');
        var father = document.querySelector('.father');
        //捕获阶段，addEventListener的第三个参数为true，则处于捕获阶段 
        // son.addEventListener('click', function() {
        //     alert('son');
        // }, true);
        // father.addEventListener('click', function() {
        //     alert('father');
        // }, true);

        //冒泡阶段 addEventListener的第三个参数为false或空，则处于冒泡阶段
        son.addEventListener('click', function() {
            alert('son');
        }, false);
        father.addEventListener('click', function() {
            alert('father');
        }, false);
    </script>
</body>

</html>